package bancosys.tec.persist.entities.domain;

import java.util.Map;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import jmine.tec.persist.annotation.Alias;

import org.hibernate.annotations.MapKey;
import org.hibernate.annotations.Type;

import bancosys.tec.component.Documentation;
import bancosys.tec.persist.authorization.annotation.DisplayName;
import bancosys.tec.persist.base.enumx.JavaEnumMock;
import bancosys.tec.utils.date.Date;

@Entity
@Alias("SUBPAI")
@DiscriminatorValue("314")
public class SubPai extends Pai {

    private Map<Date, PaiAnotado> subColecaoSemCascade;

    private JavaEnumMock subJavaEnumMock;

    @ManyToMany(fetch = FetchType.LAZY)
    @MapKey(columns = { @Column(name = "DATA", nullable = false) }, type = @Type(type = "bancosys.tec.persist.hibernate.type.DateType"))
    @JoinTable(name = "SUB_PAI_PAI_SEM_CASCADE", inverseJoinColumns = { @JoinColumn(name = "SUB_PAI_INVERSE_JOIN", nullable = false, updatable = false) }, joinColumns = { @JoinColumn(name = "PAI_JOIN", nullable = false, updatable = false) })
    @DisplayName("Coleção sem cascade do sub-pai")
    @Alias("SPPSC")
    public Map<Date, PaiAnotado> getSubColecaoSemCascade() {
        return this.subColecaoSemCascade;
    }

    public void setSubColecaoSemCascade(Map<Date, PaiAnotado> subColecaoSemCascade) {
        this.subColecaoSemCascade = subColecaoSemCascade;
    }

    /**
     * @return the subJavaEnumMock
     */
    @Column(name = "SUB_JAVA_ENUM")
    @Documentation("Comment de sub java enum.")
    public JavaEnumMock getSubJavaEnumMock() {
        return this.subJavaEnumMock;
    }

    /**
     * @param subJavaEnumMock the subJavaEnumMock to set
     */
    public void setSubJavaEnumMock(JavaEnumMock subJavaEnumMock) {
        this.subJavaEnumMock = subJavaEnumMock;
    }
}
